import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*
testCase="DBshop014_删除商品分类"
# 登录后台管理系统,地址是"http://localhost/dbshop/admin",
firefox=openBrowser(urlAdmin)
#调用自定义函数进行后台的登录
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,'商品管理','管理分类','商品分类')
firefox.find_element_by_xpath("//*[contains(.,'%s')]/following-sibling::td[4]/a[3]"%"商品分类测试").click()

time.sleep(4)
firefox.switch_to.alert.accept()
time.sleep(25)
#断言
try:
    firefox.find_element_by_xpath("//*[contains(.,'%s')]"%"商品分类测试")
    writeLog("%s 测试失败"%testCase)
    getPhoto(firefox)
except:
    writeLog("%s 测试通过" % testCase)
firefox.quit()
